home *** CD-ROM | disk | FTP | other *** search
/ C++ für Kids / C++ for kids.iso / Buch / Poly1a.cpp < prev    next >
C/C++ Source or Header  |  1999-01-15  |  1KB  |  32 lines

  1. //---------------------------------------------------------------------------
  2. #include <vcl\vcl.h>
  3. #pragma hdrstop
  4.  
  5. #include "Poly1a.h"
  6. //---------------------------------------------------------------------------
  7. #pragma resource "*.dfm"
  8.  
  9. const int FMax = 16;
  10. TColor Farbe[FMax] =
  11.   {clBlack, clMaroon, clGreen, clNavy, clTeal, clPurple,
  12.    clOlive, clGray, clSilver, clRed, clLime, clBlue,
  13.    clAqua, clFuchsia, clYellow, clWhite};
  14.  
  15. TForm1 *Form1;
  16. //---------------------------------------------------------------------------
  17. __fastcall TForm1::TForm1(TComponent* Owner)
  18.     : TForm(Owner)
  19. {
  20. }
  21. //---------------------------------------------------------------------------
  22. void __fastcall TForm1::FormCreate(TObject *Sender)
  23. {
  24.   randomize ();
  25.   Color = Farbe[random (FMax)];
  26.   Obutton1 = new TOButton (this, Farbe[random(FMax/2)+8]);
  27.   Obutton1->Parent = this;
  28.   Obutton1->SetSize (Rect(120,60,ClientWidth-120,ClientHeight-60));
  29. }
  30. //---------------------------------------------------------------------------
  31.  
  32.